<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions" 
  xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
  xmlns:camunda="http://camunda.org/schema/1.0/bpmn"
  targetNamespace="Examples">
	
	<process id="compensateProcess" isExecutable="true">

		<startEvent id="start" />
		
		<sequenceFlow sourceRef="start"	targetRef="scope" />
		
		<subProcess id="scope">

			<startEvent id="startInScope" />
			
			<sequenceFlow sourceRef="startInScope" targetRef="bookHotel" />

			<userTask id="bookHotel" name="Book Hotel" />
							
			<sequenceFlow sourceRef="bookHotel" targetRef="bookFlight" />			
	
			<userTask id="bookFlight" name="Book Flight" />
							
			<sequenceFlow sourceRef="bookFlight" targetRef="endInScope" />
			
			<endEvent id="endInScope" />
			
			<subProcess id="compensationScope" triggeredByEvent="true">
			
				<startEvent id="startIncompensationScope">
					<compensateEventDefinition />
				</startEvent>
				
				<sequenceFlow sourceRef="startIncompensationScope" targetRef="undoBookFlight" />
				
				<userTask id="undoBookFlight" name="Cancel Flight"/>
				
				<sequenceFlow sourceRef="undoBookFlight" targetRef="undoBookHotel" />
				
				<userTask id="undoBookHotel" name="Cancel Hotel"/>
				
				<sequenceFlow sourceRef="undoBookHotel" targetRef="endIncompensationScope" />
				
				<endEvent id="endIncompensationScope" />
				
			</subProcess>
	
		</subProcess>
		
		<sequenceFlow sourceRef="scope" targetRef="throwCompensation" />
		
		<userTask id="throwCompensation" name="throw compensation" />
		
		<sequenceFlow sourceRef="throwCompensation" targetRef="throwing" />
		
		<intermediateThrowEvent id="throwing">
			<compensateEventDefinition />
		</intermediateThrowEvent>  
		
		<sequenceFlow sourceRef="throwing" targetRef="end" />    
		
		<endEvent id="end" />
		
	</process>

</definitions>
